home *** CD-ROM | disk | FTP | other *** search
- /* support items*/
- #include <Quickdraw.h>
-
-
-
- #define OK_ITEM 1
-
- /*DrawOKButton*/
- /*this routine draws a hilite around the first item
- it assumes item 1 is the OK button*/
-
- DrawOKButton(theDialog)
- DialogPtr theDialog;
- {
- short itemType;
- Rect itemRect;
- Handle item;
- GrafPtr oldPort;
- GetDItem(theDialog,OK_ITEM,&itemType,&item,&itemRect);
- GetPort(&oldPort);
- SetPort(theDialog);
- PenSize(3,3);
- InsetRect(&itemRect,-4,-4);
- FrameRoundRect(&itemRect,16,16);
- PenNormal();
- SetPort(oldPort);
- }
-
-
-
- /***dialogfilter***/
- /*standard dialog filter*/
- /*returns 1:OK 2:Cancel or returns to standard*/
- pascal Boolean diafilter(DialogPtr theDlg,EventRecord *theEvent,
- short *itemHit )
- {
-
- if ( theEvent->what != keyDown ) // just looking for keystrokes
- return(FALSE);
-
- switch ( (theEvent->message) & charCodeMask ) {
- case 0x0d: // Return pressed or ...
- case 0x03: // ... Enter pressed
- *itemHit = ok;
- return( TRUE ); // Note: pascal-style TRUE
- case 0x1b:
- *itemHit = cancel; // Esc pressed
- return( TRUE );
- default:
- return( FALSE ); // all others
- }
- }
-
-
-
-
- // =========== this routine frames dialog item #1 =============
- /*this example is straight out of ModalDialog in Think Reference 2.0
- it is probably better to use this instead of drawOKbutton
- it uses a user item and procedure to draw a frame around item 1*/
- pascal void okitemproc(WindowPtr theDlg,short theItem )
- {
- Rect iRect;
- Handle iHndl;
- short iType;
-
- GetDItem (theDlg, 1, &iType, &iHndl, &iRect ); // item #1
- PenSize( 3,3 );
- InsetRect( &iRect, -4,-4);
- FrameRoundRect( &iRect, 16,16 );
- }
-